<cfcomponent displayname="Controller" extends="ModelGlue.unity.controller.Controller" output="false">

	<cffunction name="setSvnService" access= "public" returntype="void" output="false">	
		<cfargument name="svnService" type= "any" required="true">	
		<cfset variables.svnService = arguments.svnService/>
	</cffunction>

	<cffunction name="getSvnService" access= "public" returntype="any" output="false">	
		<cfreturn variables.svnService />
	</cffunction>

	<cffunction name="init" access="public" returntype="any" hint="cfjasper object constructor.">
		<cfargument name="ModelGlue" required="true" type="ModelGlue.ModelGlue" />
		<cfargument name="InstanceName" required="true" type="string" />
		<cfset super.init( arguments.ModelGlue ) />
		<cfif listFind(arguments.ModelGlue.getConfigSetting("viewMappings"),"/actionpacks/cfjasper/views")>
		ARRR<cfabort>
		</cfif>
		<cfset arguments.ModelGlue.setConfigSetting("viewMappings",listAppend(arguments.ModelGlue.getConfigSetting("viewMappings"),"/actionpacks/cfjasper/views"))>
		<cfreturn this />
	</cffunction>

	<!--- 
		Any function set up to listen for the onRequestStart message happens before any of the <event-handlers>.
		This is a good place to put things like session defaults.
	--->
	<cffunction name="onRequestStart" access="public" returnType="void" output="false">
	  <cfargument name="event" type="any">
	</cffunction>

	<!--- 
		Any function set up to listen for the onQueueComplete message happens after all event-handlers are
		finished running and before any views are rendered.  This is a good place to load constants (like UDF
		libraries) that the views may need.
	--->
	<cffunction name="onQueueComplete" access="public" returnType="void" output="false">
	  <cfargument name="event" type="any">
	</cffunction>

	<!--- 
		Any function set up to listen for the onRequestEnd message happens after views are rendered.
	--->
	<cffunction name="onRequestEnd" access="public" returnType="void" output="false">
	  <cfargument name="event" type="any">
	</cffunction>

	<cffunction name="getRepoTreeQry" access="public" returnType="void" output="false">
	  <cfargument name="event" type="any">
	  <cfset repoPath = arguments.event.getValue("repoPath")>
	  <cfset repoTreeQry = getSvnService().getSvnBrowser().List("/")>	  
	  <cfset arguments.event.setValue("repoTreeQry",repoTreeQry)>
	  <cfset arguments.event.setValue("repoBrowser",getSvnService().getSvnBrowser())>
	</cffunction>
	
	<cffunction name="getRepoResource" access="public" returnType="void" output="false">
	  <cfargument name="event" type="any">
	  <cfset resourcePath = arguments.event.getValue("resourcePath")>
	  <cfset arguments.event.setValue("repoPath",resourcePath)>
<!---
	  <cfset repoResource = getSvnService().getSvnBrowser().fileVersion(listFirst(repoPath,":"),listLast(repoPath,":"))>
	  <cfset arguments.event.setValue("repoResource",repoResource)>
 --->
	</cffunction>

	<cffunction name="getRepoResourceHistory" access="public" returnType="void" output="false">
	  <cfargument name="event" type="any">
	  <cfset resourcePath = listFirst(arguments.event.getValue("resourcePath"),":")>
	  <cfset arguments.event.setValue("repoPath",resourcePath)>
	</cffunction>

</cfcomponent>